<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>vue基础-组件创建、全局组件和局部组件</title>
</head>
<body>
    <div id="app">
        <shuai-qm></shuai-qm>
        <cool-qm></cool-qm>
    </div>
    <!-- vue2 -->
    <script src="https://cdn.jsdelivr.net/npm/vue@2.6.14"></script>
    <script>
//        全局组件
        Vue.component("shuaiQm",{
            name:"shuaiQm",
            data() {
                return {
                    hello:"hello world"
                }
            },
            template:"<h1>{{hello}}</h1>"
        });
        var app = new Vue({
            el:"#app",
            data() {
                return {
                    
                }
            },
            // 局部组件
            components:{
                coolQm:{
                    name:"coolQm",
                    data(){
                        return{
                            coolhello:"cool hello world"
                        }
                    },
                    template:"<h2>{{coolhello}}</h2>"
                }
            }
        });
    </script>
</body>
</html>